package com.java.manage.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.java.base.pojo.EasyUIResult;
import com.java.manage.mapper.TbContentMapper;
import com.java.manage.pojo.TbContent;
import com.java.manage.service.TbContentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbContentServiceImpl extends ServiceImpl<TbContentMapper,TbContent>implements TbContentService {
    /*
     *  分页查询内容
     * 
     * @author Tigger Wu
     * @date 2018/9/12 14:05
     * @param []
     * @return com.java.base.pojo.EasyUIResult
     */
    public EasyUIResult queryListByCategoryId(Integer categoryId,Integer page,Integer rows){
        Page<TbContent>contentPage = new Page<TbContent>(page,rows);
        EntityWrapper<TbContent>wrapper = new EntityWrapper<TbContent>();
        wrapper.where("category_id={0}",categoryId);
        Page<TbContent>allContent = super.selectPage(contentPage,wrapper);
        EasyUIResult ez = new EasyUIResult();
        ez.setRows(allContent.getRecords());
        ez.setTotal(allContent.getTotal());
        return  ez;
    }


}
